perm filename GRAY.MF[FIG,DEK] blob sn#767449 filedate 1984-09-03 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00004 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	% (I copied this from [mf,dek] when making APS tests, 3 Sep 84)
C00007 00003	charcode:=0
C00008 00004	r:=1
C00019 ENDMK
CāŠ—;
% (I copied this from [mf,dek] when making APS tests, 3 Sep 84)

% more-or-less general GRAY font generator
% if rep is defined, it should be a positive integer (pixels get rep bigger)
% if pixelrep is defined, it should be the representation of a pixel
% if sqsize is defined, it should be 1/4 the size of a pixel representation
% if small is defined, we make only 15 characters instead of 128

fontsetup;
if displaying>0: openit; fi;

if not known rep: rep=1; fi;

if not known sqsize:
if ppi<450: sqsize=1; else: sqsize=round(ppi/300); fi;
fi;

cw=rep*4*72.27*sqsize/ppi; % points per 4 dots
designsize:=8cw;
pxsize=rep*4*sqsize;

fontfamily "FIG";
codingscheme "GFGRAY";
fontfacebyte 78+designsize;	% for Xerox software only!

edges pix[];

if known pixelrep: pix4=pixelrep;
else:
pix1=pix4=nulledges;
addto pix1 contour
	((0,0)..(0,1)&(0,1)..(1,1)&(1,1)..(1,0)&(1,0)..(0,0)&cycle) scaled sqsize;
addto pix4 also pix1 shifted (sqsize,0);
addto pix4 also pix1 shifted (2sqsize,0);
addto pix4 also pix1 shifted (0,sqsize);
addto pix4 also pix1 shifted (0,2sqsize);
addto pix4 also pix1 shifted (sqsize,3sqsize);
addto pix4 also pix1 shifted (2sqsize,3sqsize);
addto pix4 also pix1 shifted (3sqsize,sqsize);
addto pix4 also pix1 shifted (3sqsize,2sqsize);
cull pix4 by (-1,1);
if rep>1:pix4:=pix4 shifted (-sqsize,-sqsize);
	pix5=pix4;
	for r=1 step 1 until rep-1: addto pix4 also pix5 shifted (4*r*sqsize,0);
		endfor
	pix5:=pix4;
	for r=1 step 1 until rep-1: addto pix4 also pix5 shifted (0,4*r*sqsize);
		endfor
	addto pix4 contour
		((0,0)..(0,1)&(0,1)..(1,1)&(1,1)..(1,0)&(1,0)..(0,0)&cycle)
		xscaled pxsize yscaled 2sqsize shifted (-sqsize,-sqsize)
		withweight -1;
	addto pix4 contour
		((0,0)..(0,1)&(0,1)..(1,1)&(1,1)..(1,0)&(1,0)..(0,0)&cycle)
		yscaled pxsize xscaled 2sqsize shifted (-sqsize,-sqsize)
		withweight -1;
	cull pix4 by (-9,1);
	fi
fi;

def char(expr c, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, d) =
	charcode:=c; pix0:=nulledges;
	if aa=1: addto pix0 also pix4 shifted(0,0); fi
	if ab=1: addto pix0 also pix4 shifted(0,-pxsize); fi
	if ac=1: addto pix0 also pix4 shifted(0,-2pxsize); fi
	if ad=1: addto pix0 also pix4 shifted(0,-3pxsize); fi
	if ae=1: addto pix0 also pix4 shifted(0,-4pxsize); fi
	if af=1: addto pix0 also pix4 shifted(0,-5pxsize); fi
	if ag=1: addto pix0 also pix4 shifted(0,-6pxsize); fi
	if ah=1: addto pix0 also pix4 shifted(0,-7pxsize); fi
	if ai=1: addto pix0 also pix4 shifted(0,-8pxsize); fi
	if aj=1: addto pix0 also pix4 shifted(0,-9pxsize); fi
	if ak=1: addto pix0 also pix4 shifted(0,-10pxsize); fi
	if al=1: addto pix0 also pix4 shifted(0,-11pxsize); fi
	charwd:=cw*r;
	chardw:=4r;
	charht:=cw;
	chardp:=cw*d;
	charic:=0;
if displaying>0: display pix0 inwindow window; fi;
	shipout pix0 enddef;

fontdimen 1: 0, cw, 0, 0, cw, cw, 0,
	if known rulethickness: rulethickness else: cw/2/rep fi;
charcode:=0;
pix0=nulledges;

if known dotsize:
charwd:=3*72.27*dotsize/ppi;
else: charwd:=3cw/rep; dotsize=4*sqsize+1; fi
%else: charwd:=3cw; dotsize=4*sqsize+1; fi % bug was fixed AFTER making the demos!

addto pix0 contour ((-1,0)..(0,1)..(1,0)..(0,-1)..cycle) scaled dotsize;
charht:=charwd;
chardp:=0;
charic:=0;
chardw:=1;
shipout pix0;
r:=1;
char(001,1,0,0,0,0,0,0,0,0,0,0,0,0);
char(002,0,1,0,0,0,0,0,0,0,0,0,0,1);
char(003,1,1,0,0,0,0,0,0,0,0,0,0,1);
char(004,0,0,1,0,0,0,0,0,0,0,0,0,2);
char(005,1,0,1,0,0,0,0,0,0,0,0,0,2);
char(006,0,1,1,0,0,0,0,0,0,0,0,0,2);
char(007,1,1,1,0,0,0,0,0,0,0,0,0,2);

if known small:
r:=2; addto pix4 also pix4 shifted (pxsize,0);
char(121,1,0,0,0,0,0,0,0,0,0,0,0,0);
char(122,0,1,0,0,0,0,0,0,0,0,0,0,1);
char(123,1,1,0,0,0,0,0,0,0,0,0,0,1);
char(124,0,0,1,0,0,0,0,0,0,0,0,0,2);
char(125,1,0,1,0,0,0,0,0,0,0,0,0,2);
char(126,0,1,1,0,0,0,0,0,0,0,0,0,2);
char(127,1,1,1,0,0,0,0,0,0,0,0,0,2);
charlist 1,121;
charlist 2,122;
charlist 3,123;
charlist 4,124;
charlist 5,125;
charlist 6,126;
charlist 7,127;

else:
char(008,0,0,0,1,0,0,0,0,0,0,0,0,3);
char(009,1,0,0,1,0,0,0,0,0,0,0,0,3);
char(010,0,1,0,1,0,0,0,0,0,0,0,0,3);
char(011,1,1,0,1,0,0,0,0,0,0,0,0,3);
char(012,0,0,1,1,0,0,0,0,0,0,0,0,3);
char(013,1,0,1,1,0,0,0,0,0,0,0,0,3);
char(014,0,1,1,1,0,0,0,0,0,0,0,0,3);
char(015,1,1,1,1,0,0,0,0,0,0,0,0,3);
char(016,0,0,0,0,1,0,0,0,0,0,0,0,4);
char(017,1,0,0,0,1,0,0,0,0,0,0,0,4);
char(018,0,1,0,0,1,0,0,0,0,0,0,0,4);
char(019,1,1,0,0,1,0,0,0,0,0,0,0,4);
char(020,0,0,1,0,1,0,0,0,0,0,0,0,4);
char(021,1,0,1,0,1,0,0,0,0,0,0,0,4);
char(022,0,1,1,0,1,0,0,0,0,0,0,0,4);
char(023,1,1,1,0,1,0,0,0,0,0,0,0,4);
char(024,0,0,0,1,1,0,0,0,0,0,0,0,4);
char(025,1,0,0,1,1,0,0,0,0,0,0,0,4);
char(026,0,1,0,1,1,0,0,0,0,0,0,0,4);
char(027,1,1,0,1,1,0,0,0,0,0,0,0,4);
char(028,0,0,1,1,1,0,0,0,0,0,0,0,4);
char(029,1,0,1,1,1,0,0,0,0,0,0,0,4);
char(030,0,1,1,1,1,0,0,0,0,0,0,0,4);
char(031,1,1,1,1,1,0,0,0,0,0,0,0,4);
char(032,0,0,0,0,0,1,0,0,0,0,0,0,5);
char(033,1,0,0,0,0,1,0,0,0,0,0,0,5);
char(034,0,1,0,0,0,1,0,0,0,0,0,0,5);
char(035,1,1,0,0,0,1,0,0,0,0,0,0,5);
char(036,0,0,1,0,0,1,0,0,0,0,0,0,5);
char(037,1,0,1,0,0,1,0,0,0,0,0,0,5);
char(038,0,1,1,0,0,1,0,0,0,0,0,0,5);
char(039,1,1,1,0,0,1,0,0,0,0,0,0,5);
char(040,0,0,0,1,0,1,0,0,0,0,0,0,5);
char(041,1,0,0,1,0,1,0,0,0,0,0,0,5);
char(042,0,1,0,1,0,1,0,0,0,0,0,0,5);
char(043,1,1,0,1,0,1,0,0,0,0,0,0,5);
char(044,0,0,1,1,0,1,0,0,0,0,0,0,5);
char(045,1,0,1,1,0,1,0,0,0,0,0,0,5);
char(046,0,1,1,1,0,1,0,0,0,0,0,0,5);
char(047,1,1,1,1,0,1,0,0,0,0,0,0,5);
char(048,0,0,0,0,1,1,0,0,0,0,0,0,5);
char(049,1,0,0,0,1,1,0,0,0,0,0,0,5);
char(050,0,1,0,0,1,1,0,0,0,0,0,0,5);
char(051,1,1,0,0,1,1,0,0,0,0,0,0,5);
char(052,0,0,1,0,1,1,0,0,0,0,0,0,5);
char(053,1,0,1,0,1,1,0,0,0,0,0,0,5);
char(054,0,1,1,0,1,1,0,0,0,0,0,0,5);
char(055,1,1,1,0,1,1,0,0,0,0,0,0,5);
char(056,0,0,0,1,1,1,0,0,0,0,0,0,5);
char(057,1,0,0,1,1,1,0,0,0,0,0,0,5);
char(058,0,1,0,1,1,1,0,0,0,0,0,0,5);
char(059,1,1,0,1,1,1,0,0,0,0,0,0,5);
char(060,0,0,1,1,1,1,0,0,0,0,0,0,5);
char(061,1,0,1,1,1,1,0,0,0,0,0,0,5);
char(062,0,1,1,1,1,1,0,0,0,0,0,0,5);
char(063,1,1,1,1,1,1,0,0,0,0,0,0,5);
char(064,0,0,0,0,0,0,1,0,0,0,0,0,6);
char(065,0,0,0,0,0,1,1,0,0,0,0,0,6);
char(066,0,0,0,0,1,1,1,0,0,0,0,0,6);
char(067,0,0,0,1,1,1,1,0,0,0,0,0,6);
char(068,0,0,1,1,1,1,1,0,0,0,0,0,6);
char(069,0,1,1,1,1,1,1,0,0,0,0,0,6);
char(070,1,1,1,1,1,1,1,0,0,0,0,0,6);
char(071,0,0,0,0,0,0,0,1,0,0,0,0,7);
char(072,0,0,0,0,0,0,1,1,0,0,0,0,7);
char(073,0,0,0,0,0,1,1,1,0,0,0,0,7);
char(074,0,0,0,0,1,1,1,1,0,0,0,0,7);
char(075,0,0,0,1,1,1,1,1,0,0,0,0,7);
char(076,0,0,1,1,1,1,1,1,0,0,0,0,7);
char(077,0,1,1,1,1,1,1,1,0,0,0,0,7);
char(078,1,1,1,1,1,1,1,1,0,0,0,0,7);
char(079,0,0,0,0,0,0,0,0,1,0,0,0,8);
char(080,0,0,0,0,0,0,0,1,1,0,0,0,8);
char(081,0,0,0,0,0,0,1,1,1,0,0,0,8);
char(082,0,0,0,0,0,1,1,1,1,0,0,0,8);
char(083,0,0,0,0,1,1,1,1,1,0,0,0,8);
char(084,0,0,0,1,1,1,1,1,1,0,0,0,8);
char(085,0,0,1,1,1,1,1,1,1,0,0,0,8);
char(086,0,1,1,1,1,1,1,1,1,0,0,0,8);
char(087,1,1,1,1,1,1,1,1,1,0,0,0,8);
char(088,0,0,0,0,0,0,0,0,0,1,0,0,9);
char(089,0,0,0,0,0,0,0,0,1,1,0,0,9);
char(090,0,0,0,0,0,0,0,1,1,1,0,0,9);
char(091,0,0,0,0,0,0,1,1,1,1,0,0,9);
char(092,0,0,0,0,0,1,1,1,1,1,0,0,9);
char(093,0,0,0,0,1,1,1,1,1,1,0,0,9);
char(094,0,0,0,1,1,1,1,1,1,1,0,0,9);
char(095,0,0,1,1,1,1,1,1,1,1,0,0,9);
char(096,0,1,1,1,1,1,1,1,1,1,0,0,9);
char(097,1,1,1,1,1,1,1,1,1,1,0,0,9);
char(098,0,0,0,0,0,0,0,0,0,0,1,0,10);
char(099,0,0,0,0,0,0,0,0,0,1,1,0,10);
char(100,0,0,0,0,0,0,0,0,1,1,1,0,10);
char(101,0,0,0,0,0,0,0,1,1,1,1,0,10);
char(102,0,0,0,0,0,0,1,1,1,1,1,0,10);
char(103,0,0,0,0,0,1,1,1,1,1,1,0,10);
char(104,0,0,0,0,1,1,1,1,1,1,1,0,10);
char(105,0,0,0,1,1,1,1,1,1,1,1,0,10);
char(106,0,0,1,1,1,1,1,1,1,1,1,0,10);
char(107,0,1,1,1,1,1,1,1,1,1,1,0,10);
char(108,1,1,1,1,1,1,1,1,1,1,1,0,10);
char(109,0,0,0,0,0,0,0,0,0,0,0,1,11);
char(110,0,0,0,0,0,0,0,0,0,0,1,1,11);
char(111,0,0,0,0,0,0,0,0,0,1,1,1,11);
char(112,0,0,0,0,0,0,0,0,1,1,1,1,11);
char(113,0,0,0,0,0,0,0,1,1,1,1,1,11);
char(114,0,0,0,0,0,0,1,1,1,1,1,1,11);
char(115,0,0,0,0,0,1,1,1,1,1,1,1,11);
char(116,0,0,0,0,1,1,1,1,1,1,1,1,11);
char(117,0,0,0,1,1,1,1,1,1,1,1,1,11);
char(118,0,0,1,1,1,1,1,1,1,1,1,1,11);
char(119,0,1,1,1,1,1,1,1,1,1,1,1,11);
char(120,1,1,1,1,1,1,1,1,1,1,1,1,11);
r:=2; addto pix4 also pix4 shifted (pxsize,0);
char(121,1,1,1,1,1,1,1,1,1,1,1,1,11);
r:=4; addto pix4 also pix4 shifted (2pxsize,0);
char(122,1,1,1,1,1,1,1,1,1,1,1,1,11);
charlist 120, 121, 122;
fi
end